﻿function MyAlert(Title, Content, BtnText, IsSuccess, cssDemo, Address) {
    $("#myModal").remove();
    var MyAlertHtml = new Array();
    MyAlertHtml.push("<div class=\"modal fade\" id=\"myModal\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">");
    MyAlertHtml.push("<div class=\"modal-dialog\">");
    MyAlertHtml.push("<div class=\" alert  alert-");
    MyAlertHtml.push(cssDemo);
    MyAlertHtml.push(" modal-content\">")
    MyAlertHtml.push("<div class=\"modal-header\">");
    MyAlertHtml.push("<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">");
    MyAlertHtml.push("&times;");
    MyAlertHtml.push("</button>");
    MyAlertHtml.push("<h2 class=\"modal-title\" id=\"myModalLabel\">");
    MyAlertHtml.push(Title);
    MyAlertHtml.push("</h2>");
    MyAlertHtml.push("</div>");
    MyAlertHtml.push("<div class=\"modal-body\">");
    MyAlertHtml.push(Content);
    MyAlertHtml.push("</div>");
    MyAlertHtml.push("<div class=\"modal-footer\">");
    MyAlertHtml.push("<button type=\"button\" class=\"btn btn-");
    MyAlertHtml.push(cssDemo);
    MyAlertHtml.push("\" data-dismiss=\"modal\">");
    MyAlertHtml.push(BtnText);
    MyAlertHtml.push("</button>");
    MyAlertHtml.push("</div>");
    MyAlertHtml.push("</div>");
    MyAlertHtml.push("</div>");
    MyAlertHtml.push("</div>");
    $("body").append(MyAlertHtml.join(""));
    $("#myModal").modal("show");
    if (IsSuccess) {
        $('#myModal').on('hidden.bs.modal', function () {
            location.href = Address;
        })
    }
}

